var o = require("Utils");
cc.Class({
    extends: cc.Component,
    properties: {
        _starType: 0,
        _gx: 0,
        _gy: 0,
        starSprite: cc.Sprite,
        selected: cc.Sprite,
        starSpriteFrames: {
            default: [],
            type: cc.SpriteFrame
        }
    },
    initW: function (t) {
        this.node.width = t - 2, this.node.height = t - 2, this.node.active = !1;
    },
    initStar: function (t, e, n) {
        this.selected.node.active = !1, this._starType = t, this.starSprite.spriteFrame = this.starSpriteFrames[this._starType],
            this.updateGrid(e, n);
    },

    changeStarType: function (t) {
        this._starType = t, this.starSprite.spriteFrame = this.starSpriteFrames[t];
    },
    updateGrid: function (t, e) {
        this._gx = t, this._gy = e;
    },
    goIntoDrop: function (t) {
        var e = t.delay;
        this.node.opacity = 0;
        var n = o.grid2Pos(this._gx, this._gy);
        this.node.setPosition(t.pos), this.scheduleOnce(function () {
            var t = cc.fadeTo(.15, 255),
                e = cc.moveTo(.25, n),
                o = cc.spawn(t, e);
            this.node.runAction(o);
        }, e);
    },
    fromSmallToBigAction: function (t) {
        var e = t.delay;
        this.scheduleOnce(function () {
            var e = cc.callFunc(function () {
                    this.changeStarType(t.type);
                }, this),
                n = cc.sequence(cc.scaleTo(.35, 0), e, cc.scaleTo(.35, 1));
            this.node.runAction(n);
        }, e);
    }
})